package csd.wyaiyr.com.controller;


import csd.wyaiyr.com.config.BaseResult;
import csd.wyaiyr.com.config.BaseResultPage;
import csd.wyaiyr.com.model.MonitorData;
import csd.wyaiyr.com.model.dto.MoniDataQueryPageReqDto;
import csd.wyaiyr.com.service.SolimonitorService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Tag(name = "土壤监测api")
@RestController
@RequestMapping("/common/monitor")
public class SolimonitorController {

    @Autowired
    private SolimonitorService solimonitorService;

    @Operation(summary = "新增")
    @PostMapping("/insert")
    public BaseResult insert(@RequestBody MonitorData monitorData){
        return solimonitorService.insert(monitorData);
    }


    @Operation(summary = "监测数据列表")
    @PostMapping("/list")
    public BaseResultPage list(@RequestBody MoniDataQueryPageReqDto pageReqDto){
        return solimonitorService.list(pageReqDto);
    }

    @Operation(summary = "AI分析")
    @PostMapping("/getAiAdviceBydate")
    public BaseResult getAiAdviceBydate(String datastr){
        return solimonitorService.getAiAdviceBydate(datastr);
    }


    @Operation(summary = "AI分析列表")
    @PostMapping("/advicelist")
    public BaseResultPage advicelist(@RequestBody MoniDataQueryPageReqDto pageReqDto){
        return solimonitorService.advicelist(pageReqDto);
    }

}
